#include <iostream>
using namespace std;
#include "threadpool.hpp"
#include "Task copy.hpp"
#include <ctime>
#include<unistd.h>

int main()
{
    srand(time(nullptr));
   // threadpool<Task>* tp=new threadpool<Task>(5);
   //单例模式
    threadpool<Task>::GetInstacne()->start();//线程跑起来
    int len=opers.size();
    while(true)
    {
        //1.构建任务
        int x=rand()%10+1;
        usleep(10);
        int y=rand()%10;
        char c=opers[rand()%len];
        Task t(x,y,c);
        //2.交给线程池处理
       // tp->push(t);
       threadpool<Task>::GetInstacne()->push(t);
        std::cout<<"main thread make task done: task is: "<<t.getTask()<<endl;
        sleep(1);
    }
    return 0;
}